/*
Author -> Jesse Weed @ Codzy <http://codzy.com>
Copyright -> (c) 2010 Sublantic, LLC <http://sublantic.com>
License -> MIT License
*/

var storage = {

	method : 'set',
	name : 'null',
	value : 'null',
	storage : false,

	// Check for local storage
	check : function() {
		if (localStorage.getItem('storageTest')) {
		this.storage = true;
		} else {
		localStorage.setItem('storageTest', true);
			if (localStorage.getItem('storageTest')) {
			this.storage = true;
			}
		}
	}, // End function

	// Set an item
	set : function(name, value) {
		if (this.storage===true) {
		localStorage.setItem(name, value);
		} else {
		Cookie.write(name, value, {duration: 30, path: '/'});
		}
	}, // End function
	
	// Get an item
	get : function(name) {
		if (this.storage===true) {
		return localStorage.getItem(name);
		} else {
		return Cookie.read(name);
		}
	}, // End function
	
	// Remove an item
	remove : function(name) {
		if (this.storage===true) {
		localStorage.removeItem(name);
		} else {
		Cookie.dispose(name, {path: '/'});
		}
	} // End function

}

storage.check(); // Run local storage check